package net.zubara.esni.core.client;

import net.zubara.esni.core.util.ECoreConstant;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.ecf.core.ContainerCreateException;
import org.eclipse.ecf.core.ContainerFactory;
import org.eclipse.ecf.core.IContainer;

public abstract class AbstractRestClient {

	Log log = LogFactory.getLog(AbstractRestClient.class);

	protected IContainer container;

	protected String uri;

	public AbstractRestClient() {
		this.uri = initUri();
		initRestContainer();
	}

	protected void initRestContainer() {
		try {
			container = ContainerFactory.getDefault().createContainer(ECoreConstant.REST_CONTAINER_TYPE.value(), new Object[] { uri });
		} catch (ContainerCreateException e) {
			log.error(e);
		}
	}

	protected abstract String initUri();

}
